package com.nbsaas.boot.ai.rest.convert;

import com.nbsaas.boot.ai.data.entity.AiAgentConfig;
import com.nbsaas.boot.ai.api.domain.simple.AiAgentConfigSimple;

import com.nbsaas.boot.rest.api.Converter;

import java.util.HashMap;
import java.util.Map;

/**
 * 智能体配置-列表对象转换器
 */

public class AiAgentConfigSimpleConvert implements Converter<AiAgentConfigSimple, AiAgentConfig> {


    @Override
    public AiAgentConfigSimple convert(AiAgentConfig source) {
        AiAgentConfigSimple result = new AiAgentConfigSimple();

        result.setToolConfig(source.getToolConfig());
        result.setNote(source.getNote());
        result.setCode(source.getCode());
        result.setDescription(source.getDescription());
        result.setSort(source.getSort());
        result.setTopP(source.getTopP());
        result.setAddDate(source.getAddDate());
        if (source.getEnabled() != null) {
            Map<Integer, String> EnabledMap = new HashMap<>();
            EnabledMap.put(1, "启用");
            EnabledMap.put(-1, "禁用");
            String label = EnabledMap.get(source.getEnabled());
            result.setEnabledName(label);
        }
        result.setEnabled(source.getEnabled());
        result.setPresencePenalty(source.getPresencePenalty());
        result.setSystemPrompt(source.getSystemPrompt());
        result.setProvider(source.getProvider());
        result.setName(source.getName());
        result.setTemperature(source.getTemperature());
        result.setMaxTokens(source.getMaxTokens());
        result.setModel(source.getModel());
        result.setId(source.getId());
        result.setFrequencyPenalty(source.getFrequencyPenalty());
        result.setLastDate(source.getLastDate());


        return result;
    }

}